import service from '@/utils/request.js'

const projectApi = {
    list(projectQuery) {
        return service.get('/project/list', {params: projectQuery})
    },
    deleteById(id) {
        return service.delete(`/project/deleteById/${id}`)
    },
    deleteAll(ids) {
        return service.delete( `/project/deleteAll/${ids}`)
    },
    add(project) {
        //project以JSON形式传递到后台，后端使用@RequestBody接收
        return service.post('/project/add', project)
    },
    selectById(id) {
        return service.get(`/project/selectById/${id}`)
    },
    update(project) {
        return service.put('/project/update', project)
    },
    selectAll() {
        return service.get(`/project/selectAll`)
    },
    selectNotAll() {
        return service.get(`/project/selectNotAll`)
    },
    exportExcel() {
        return service({
            url: `/project/exportExcel`,
            method: 'get',
            //XMLHttpRequest 属性 responseType 是一个枚举字符串值，用于指定响应中包含的数据类型。
            //"blob": response 是一个包含二进制数据的 Blob 对象。
            responseType: 'blob'
        })
    }
}

export default projectApi